package service

import (
	"github.com/gin-gonic/gin"
	"gorm.io/gorm"
	"yxs-mall/common/models"
	"yxs-mall/common/storage"
)

type Service struct {
	models.CurrentUser
	Orm   *gorm.DB
	Msg   string
	MsgID string
	Error error
}

func (s *Service) Make(c *gin.Context) *Service {
	if user, exists := c.Get("currentUser"); exists {
		s.CurrentUser = user.(models.CurrentUser)
	}
	s.Orm = storage.DB
	return s
}
